package com.tanhua.server.controller;

import com.tanhua.server.pojo.SoulTestTable;
import com.tanhua.server.service.TestSoulService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("testSoul")
public class TestSoulController {

    @Autowired
    private TestSoulService testSoulService;

    /**
     * 获取问卷
     * @return
     */
    @GetMapping
    public List<SoulTestTable> getTestSoulTable(){
        return testSoulService.getTestSoulTable();
    }

    /**
     * 提交问卷
     * @return
     */
    @PostMapping
    public String submitTestSoulTable(@RequestBody Map<String,List<Integer>> map){
        List<Integer> optionIds = map.get("optionId");
        return testSoulService.submitTestSoulTable(optionIds);
    }

    /**
     * 提交问卷
     * @return
     */
    @GetMapping("report/{id}")
    public String submitTestSoulTable(@PathVariable(name = "id")String id){
        return null;
    }
}
